package com.zhouyu.exampleThread.threadTest;

import lombok.extern.log4j.Log4j2;

/**
 * @Description:volatile关键字
 */
@Log4j2
public class Testvolatile implements Runnable {
  private boolean isstop=true;
  //private volatile boolean isstop=true;
  @Override
  public void run() {
    while (isstop){
      log.info("线程名:{}",Thread.currentThread().getName());
    }
    log.info("我被停止了");
  }

  public boolean isIsstop() {
    return isstop;
  }

  public void setIsstop(boolean isstop) {
    this.isstop = isstop;
  }
}
